#include "Buzzer.h"
#include "main.h"

void Buzzer_bee(Buzzer_Type_Bee level) {
  if (level == Buzzer_Type_Bee_stop) {
    LL_TIM_CC_DisableChannel(TIM1, LL_TIM_CHANNEL_CH1);
  } else {
    uint16_t pulse = 1000 + (uint16_t)level * 3000;
    LL_TIM_CC_DisableChannel(TIM1, LL_TIM_CHANNEL_CH1);
    LL_TIM_OC_SetCompareCH1(TIM1, pulse);
    LL_TIM_SetCounter(TIM1, 0);
    LL_TIM_CC_EnableChannel(TIM1, LL_TIM_CHANNEL_CH1);
  }
}
